.class public Lnet/oauth/http/HttpMessageDecoder;
.super Lnet/oauth/http/HttpResponseMessage;
.source "HttpMessageDecoder.java"


# static fields
#the value of this static final field might be set in the static constructor
.field static final synthetic $assertionsDisabled:Z = false

.field public static final ACCEPTED:Ljava/lang/String; = "gzip,deflate"

.field public static final DEFLATE:Ljava/lang/String; = "deflate"

.field public static final GZIP:Ljava/lang/String; = "gzip"


# instance fields
.field private final in:Lnet/oauth/http/HttpResponseMessage;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 26
    const-class v0, Lnet/oauth/http/HttpMessageDecoder;

    invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    sput-boolean v0, Lnet/oauth/http/HttpMessageDecoder;->$assertionsDisabled:Z

    return-void

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private constructor <init>(Lnet/oauth/http/HttpResponseMessage;Ljava/lang/String;)V
    .locals 4
    .parameter "in"
    .parameter "encoding"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 64
    iget-object v2, p1, Lnet/oauth/http/HttpResponseMessage;->method:Ljava/lang/String;

    iget-object v3, p1, Lnet/oauth/http/HttpResponseMessage;->url:Ljava/net/URL;

    invoke-direct {p0, v2, v3}, Lnet/oauth/http/HttpResponseMessage;-><init>(Ljava/lang/String;Ljava/net/URL;)V

    .line 65
    iget-object v2, p0, Lnet/oauth/http/HttpMessageDecoder;->headers:Ljava/util/List;

    iget-object v3, p1, Lnet/oauth/http/HttpResponseMessage;->headers:Ljava/util/List;

    invoke-interface {v2, v3}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 66
    const-string v2, "Content-Encoding"

    invoke-virtual {p0, v2}, Lnet/oauth/http/HttpMessageDecoder;->removeHeaders(Ljava/lang/String;)Ljava/lang/String;

    .line 67
    const-string v2, "Content-Length"

    invoke-virtual {p0, v2}, Lnet/oauth/http/HttpMessageDecoder;->removeHeaders(Ljava/lang/String;)Ljava/lang/String;

    .line 68
    invoke-virtual {p1}, Lnet/oauth/http/HttpResponseMessage;->getBody()Ljava/io/InputStream;

    move-result-object v0

    .line 69
    .local v0, body:Ljava/io/InputStream;
    if-eqz v0, :cond_0

    .line 70
    const-string v2, "gzip"

    if-ne p2, v2, :cond_1

    .line 71
    new-instance v1, Ljava/util/zip/GZIPInputStream;

    invoke-direct {v1, v0}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V

    .end local v0           #body:Ljava/io/InputStream;
    .local v1, body:Ljava/io/InputStream;
    move-object v0, v1

    .line 78
    .end local v1           #body:Ljava/io/InputStream;
    .restart local v0       #body:Ljava/io/InputStream;
    :cond_0
    :goto_0
    iput-object v0, p0, Lnet/oauth/http/HttpMessageDecoder;->body:Ljava/io/InputStream;

    .line 79
    iput-object p1, p0, Lnet/oauth/http/HttpMessageDecoder;->in:Lnet/oauth/http/HttpResponseMessage;

    .line 80
    return-void

    .line 72
    :cond_1
    const-string v2, "deflate"

    if-ne p2, v2, :cond_2

    .line 73
    new-instance v1, Ljava/util/zip/InflaterInputStream;

    invoke-direct {v1, v0}, Ljava/util/zip/InflaterInputStream;-><init>(Ljava/io/InputStream;)V

    .end local v0           #body:Ljava/io/InputStream;
    .restart local v1       #body:Ljava/io/InputStream;
    move-object v0, v1

    .end local v1           #body:Ljava/io/InputStream;
    .restart local v0       #body:Ljava/io/InputStream;
    goto :goto_0

    .line 75
    :cond_2
    sget-boolean v2, Lnet/oauth/http/HttpMessageDecoder;->$assertionsDisabled:Z

    if-nez v2, :cond_0

    new-instance v2, Ljava/lang/AssertionError;

    invoke-direct {v2}, Ljava/lang/AssertionError;-><init>()V

    throw v2
.end method

.method public static decode(Lnet/oauth/http/HttpResponseMessage;)Lnet/oauth/http/HttpResponseMessage;
    .locals 2
    .parameter "message"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 36
    if-eqz p0, :cond_0

    .line 37
    invoke-static {p0}, Lnet/oauth/http/HttpMessageDecoder;->getEncoding(Lnet/oauth/http/HttpMessage;)Ljava/lang/String;

    move-result-object v0

    .line 38
    .local v0, encoding:Ljava/lang/String;
    if-eqz v0, :cond_0

    .line 39
    new-instance v1, Lnet/oauth/http/HttpMessageDecoder;

    invoke-direct {v1, p0, v0}, Lnet/oauth/http/HttpMessageDecoder;-><init>(Lnet/oauth/http/HttpResponseMessage;Ljava/lang/String;)V

    move-object p0, v1

    .line 42
    .end local v0           #encoding:Ljava/lang/String;
    .end local p0
    :cond_0
    return-object p0
.end method

.method private static getEncoding(Lnet/oauth/http/HttpMessage;)Ljava/lang/String;
    .locals 2
    .parameter "message"

    .prologue
    .line 50
    const-string v1, "Content-Encoding"

    invoke-virtual {p0, v1}, Lnet/oauth/http/HttpMessage;->getHeader(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 51
    .local v0, encoding:Ljava/lang/String;
    if-nez v0, :cond_1

    .line 59
    :cond_0
    const/4 v1, 0x0

    :goto_0
    return-object v1

    .line 53
    :cond_1
    const-string v1, "gzip"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_2

    const-string v1, "x-gzip"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_3

    .line 55
    :cond_2
    const-string v1, "gzip"

    goto :goto_0

    .line 56
    :cond_3
    const-string v1, "deflate"

    invoke-virtual {v1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 57
    const-string v1, "deflate"

    goto :goto_0
.end method


# virtual methods
.method public dump(Ljava/util/Map;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 86
    .local p1, into:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    iget-object v0, p0, Lnet/oauth/http/HttpMessageDecoder;->in:Lnet/oauth/http/HttpResponseMessage;

    invoke-virtual {v0, p1}, Lnet/oauth/http/HttpResponseMessage;->dump(Ljava/util/Map;)V

    .line 87
    return-void
.end method

.method public getStatusCode()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 91
    iget-object v0, p0, Lnet/oauth/http/HttpMessageDecoder;->in:Lnet/oauth/http/HttpResponseMessage;

    invoke-virtual {v0}, Lnet/oauth/http/HttpResponseMessage;->getStatusCode()I

    move-result v0

    return v0
.end method
